Skip to content

[core] Do not pushdown limit when non partition filter is present#7665

Merged
JingsongLi merged 10 commits intoapache:masterfrom
XiaoHongbo-Hope:limit_pushdown_fix
Apr 17, 2026
Merged

[core] Do not pushdown limit when non partition filter is present#7665
JingsongLi merged 10 commits intoapache:masterfrom
XiaoHongbo-Hope:limit_pushdown_fix

Conversation

@XiaoHongbo-Hope
Copy link
Copy Markdown
Contributor

@XiaoHongbo-Hope XiaoHongbo-Hope commented Apr 17, 2026

Purpose

If limit pushdown is applied before non-partition filters are evaluated, scanning may stop too early and return fewer rows than requested. To fix this, limit pushdown is disabled when non-partition filters exist.

Tests

@XiaoHongbo-Hope XiaoHongbo-Hope marked this pull request as ready for review April 17, 2026 08:11
@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [core] Do not limit pushdown with filter is present [core] Do not pushdown limit when filter is present Apr 17, 2026
@XiaoHongbo-Hope XiaoHongbo-Hope marked this pull request as draft April 17, 2026 08:18
@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [core] Do not pushdown limit when filter is present [core] Do not pushdown limit when non partition filter is present Apr 17, 2026
@XiaoHongbo-Hope XiaoHongbo-Hope marked this pull request as ready for review April 17, 2026 09:50
@XiaoHongbo-Hope
Copy link
Copy Markdown
Contributor Author

@wwj6591812 Could you please help take a look at this PR.

@XiaoHongbo-Hope XiaoHongbo-Hope marked this pull request as draft April 17, 2026 10:35
@XiaoHongbo-Hope XiaoHongbo-Hope marked this pull request as ready for review April 17, 2026 10:39
@@ -126,7 +132,7 @@ public List<PartitionEntry> listPartitionEntries() {
}

private Optional<StartingScanner.Result> applyPushDownLimit() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be in SnapshotReaderImpl, withFilter already know if there is non-part filter. (!pair.getRight().isEmpty())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be in SnapshotReaderImpl, withFilter already know if there is non-part filter. (!pair.getRight().isEmpty())

Updated

@JingsongLi
Copy link
Copy Markdown
Contributor

+1

@JingsongLi JingsongLi merged commit 6f6dcc9 into apache:master Apr 17, 2026
19 of 24 checks passed
XiaoHongbo-Hope added a commit that referenced this pull request Apr 19, 2026
)

If limit pushdown is applied before non-partition filters are evaluated,
scanning may stop too early and return fewer rows than requested. To fix
this, limit pushdown is disabled when non-partition filters exist.
@wwj6591812
Copy link
Copy Markdown
Contributor

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants